<?php
namespace app\api\controller;
use think\Controller;
use app\api\model\Cuser;
/**
 * 
 * @author sj
 * 公共控制器进行请求验证/seesion验证是否是已登录状态/token记住密码登录
 *
 */
class Co extends Controller{
    public function _initialize(){
        /**验证请求头/加密
         */
        
       /** $checkSum=empty(input('get.checkSum'))?ajaxReturn2('404','fuck your mother','sb'):input('get.checkSum');
        $re=$this->checkRequest($checkSum);
        if(!$re){
            $this->redirect('/api/Error/fuck');
        }**/
       /** $cModel=new Cuser();
        $id=$cModel->checkToken();
       **/
        /**if(!empty($id)&&!session('user_id')){
            session('user_id',$id['user_id']);
          // echo "ss";
        }
        **/
       // session('user_id',1);
        //echo session('user_id');
        //$module=request()->module();
        if(!empty(input('get.access_token'))){
            session('access_token',input('get.access_token'));
        }
        if(!empty(input('get.openid'))){
            session('openid',input('get.openid'));
        }
        
        $controller=request()->controller();
        $action=request()->action();
        $para=[$controller,$action];
        if(!session('user_id')){
           return  $this->redirect('api/user/login',array('c'=>$controller,'a'=>$action));
        }
        
    }
}